<#import "../tpl/pageTep.ftl" as page>
<@page.pageBase currentMenu="审批活动">
<style>
    /***费用只显示数字的表单***/
    .time {
        display: inline-block;
        height: 20px;
        line-height: 20px;
        padding: 4px 12px;
        border: 1px solid #cccccc;
        border-radius: 4px;
        vertical-align: middle;
    }

    /***循环的表单设置***/
    .bui-select .bui-select-input {
        width: 350px;
    }

    .button-large {
        padding: 10px 30px;
        font-size: 16px;
    }
</style>
<div class="xm-offline">
    <div class="row">
        <div class="panel">
            <div class="panel-header">
                <a href="${basepath}/manage/offline/toCheckList">返回上一级</a>
            </div>
            <div class="panel-body">
                <form id="detailForm" class="form-horizontal" action="${basepath}/manage/offline/updateJson"
                      method="post">
                    <input type="hidden" class="control-text span-width span10" name="id" value="">

                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            活动名称：
                        </label>

                        <div class="controls">
                            <input type="text" class="control-text span-width span10" name="name" value="${e.id!}"
                                   placeholder="请输入活动名称" disabled="disabled">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            机构名称：
                        </label>

                        <div class="controls">
                            <input type="text" class=" control-text span-width span10" name="organizeName"
                                   value="${e.organizeName!}" disabled="disabled">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            负责人：
                        </label>

                        <div class="controls">
                            <input type="text" class="control-text span-width span10" name="principal"
                                   value="${e.principal!}" disabled="disabled">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            联系电话：
                        </label>

                        <div class="controls">
                            <input type="text" class="tel control-text span-width span10" name="principalPhone"
                                   value="${e.principalPhone!}" disabled="disabled">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            所在地区：
                        </label>

                        <div class="controls">
                            <input type="text" class="control-text span-width span2" name="province"
                                   value="${e.province!}" disabled="disabled"/>&nbsp;&nbsp;
                            <input type="text" class="control-text span-width span2" name="city" value="${e.city!}"
                                   disabled="disabled"/>&nbsp;&nbsp;
                            <input type="text" class="control-text span-width span2" name="area" value="${e.area!}"
                                   disabled="disabled"/>&nbsp;&nbsp;
                            <input type="text" class="control-text span-width span10" name="address"
                                   value="${e.address!}" disabled="disabled"/>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            开始日期：
                        </label>

                        <div class="controls">
                            <input type="text" class="control-text span-width span10" name="beginTime"
                                   value="${e.beginTime!}" disabled="disabled"/>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            结束日期：
                        </label>

                        <div class="controls">
                            <input type="text" class="control-text span-width span10" name="endTime"
                                   value="${e.endTime!}" disabled="disabled"/>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            活动时段：
                        </label>

                        <div class="controls">
                            <input type="text" name="beginTimeFrame" value="${e.beginTimeFrame!}"
                                   disabled="disabled"><label>
                            &nbsp;-&nbsp;</label>
                            <input type="text" name="endTimeFrame" class="time" value="${e.endTimeFrame!}"
                                   disabled="disabled">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            周期循环：
                        </label>

                        <div class="controls " id="s1">
                            <input type="hidden" id="hide" name="circulation" value="${e.circulation!}"
                                   disabled="disabled">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            活动类型：</label>

                        <div class="controls">
                            <input type="text" class="control-text" name="type" value=""
                                   disabled="disabled" id="type"/>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            参与人员：
                        </label>

                        <div class="controls">
                            <input type="text" class="control-text" name="participant" value=""
                                   disabled="disabled" id="participant"/>

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            报名条件：
                        </label>

                        <div class="controls">
                            <input type="text" class="control-text span-width span10" name=""
                                   value="${e.conditions!}" disabled="disabled"/>
                        </div>
                    </div>
                    <div class="control-group" id="offline-limits">
                        <label class="control-label">
                            参与人数：
                        </label>

                        <div class="controls">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            活动介绍：
                        </label>

                        <div class="controls control-row12" style="height: 350px;initialFrameWidth: 100%;">
                            <textarea type="text" class="input-large" name="content"
                                      id="content">${e.content!}</textarea>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            推送资讯栏：</label>

                        <div class="controls">
                            <input type="text" class="control-text" name="send" value=""
                                   disabled="disabled" id="send"/>
                        </div>
                    </div>
                    <div class="centered">
                        <a class="button button-large button-success" id="btnShow">审核</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<#-------------------------------------------------------编辑审核状态 begin-------------------------------------------------------->
<div id="editContent" style="display:none;">
    <form id="editForm" class="form-horizontal" action="${basepath}/manage/offline/checkOffline" method="post">
        <input type="hidden" class="input-normal control-text" name="id" value="${e.id!}"/>

        <div class="row">
            <div class="control-group span16">
                <label class="control-label">审核状态：</label>

                <div class="controls control-row4">
                    <select data-rules="{required:true}" name="status" value="${e.status!}" id="status">
                        <option value="">-请选择-</option>
                        <option value="2">通过</option>
                        <option value="6">不通过</option>
                    </select>
                </div>
            </div>
        </div>
    </form>
<#-------------------------------------------------------审核状态 end-------------------------------------------------------->

    <script type="text/javascript">
        //ueditor编辑器不可编辑状态
        var editor = UE.getEditor('content', {
            readonly: true
        });
        var Grid = BUI.Grid;
        var Store = BUI.Data.Store;
        var editForm = new BUI.Form.Form({
            srcNode: '#editForm',
            submitType: 'ajax',
            callback: function (data) {
                if (data.success == true) {
                    window.location.href = "${basepath}/manage/offline/toCheckList"
                } else {

                }
            }
        }).render();
        editForm.render();
        var editDialog = new BUI.Overlay.Dialog({
            title: '编辑审核状态',
            width: 500,
            height: 120,
            contentId: 'editContent',
            success: function () {
                editForm.ajaxSubmit();
            }
        });
        //编辑按钮事件
        $('#btnShow').on('click', function () {
            editDialog.show();
        });
        //对活动类型做判断塞值到input中
        var type = "${e.type!}";
        if (type == "1") {
            $("#type").val("志愿活动");
        } else {
            $("#type").val("募捐活动");
        }
        //对参与对象做判断塞值到input中
        var participant = "${e.participant!}";
        if (participant == "1") {
            $("#participant").val("所有志愿者");
        } else if (participant == "2") {
            $("#participant").val("仅限内部志愿者");
        } else {
            $("#participant").val("仅限外部志愿者");
        }
        //对是否推送到资讯栏做判断塞值到input中
        var send = "${e.send!}";
        if (send == "y") {
            $("#send").val("是");
        } else {
            $("#send").val("否");
        }
        //参与人数
        var limits = "${e.limits!}";
        var limitsHtml = "";
        if (limits == "0") {
            limitsHtml = '<input type="text" class="control-text span-width span10" name="limits " value="不限" disabled="disabled" />';

        } else {
            limitsHtml = '<input type="text" class="control-text span-width span10" name="limits " value="' + limits + '" disabled="disabled" />';
        }
        document.getElementById("offline-limits").innerHTML += limitsHtml;
        /*--------------------------循环的选项  begin--------------------*/
        BUI.use('bui/select', function (Select) {

            var items = [
                        {text: '周一', value: '周一'},
                        {text: '周二', value: '周二'},
                        {text: '周三', value: '周三'},
                        {text: '周四', value: '周四'},
                        {text: '周五', value: '周五'},
                        {text: '周六', value: '周六'},
                        {text: '周日', value: '周日'}
                    ],
                    select = new Select.Select({
                        render: '#s1',
                        valueField: '#hide',
                        multipleSelect: true,
                        disabled: true,
                        items: items
                    });
            select.render();
        });

        /*--------------------------循环的选项  end--------------------*/
    </script>

</@page.pageBase>